import { createRouter,createWebHistory } from "vue-router"

//导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'

import UserInfoVue from '@/views/userInfo/UserInfo.vue'
import UserAvatarVue from '@/views/userInfo/UserAvatar.vue'
import UserResetPasswordVue from '@/views/userInfo/UserResetPassword.vue'

import CookFoodVue from '@/views/cook/Food.vue'
import CookEatVue from '@/views/cook/Eat.vue'
import CookIngredientsVue from '@/views/cook/Ingredients.vue'
import CookDrinkVue from '@/views/cook/Drink.vue'

//定义路由关系
const routes = [
    {path:'/login',component:LoginVue},
    {
        path:'/user',
        component:LayoutVue,
        redirect:'/user/cook/food',children:[
            {path:'/user/userInfo/info',component:UserInfoVue},
            {path:'/user/userInfo/avatar',component:UserAvatarVue},
            {path:'/user/userInfo/resetPassword',component:UserResetPasswordVue},
            {path:'/user/cook/food',component:CookFoodVue},
            {path:'/user/cook/eat',component:CookEatVue},
            {path:'/user/cook/ingredients',component:CookIngredientsVue},
            {path:'/user/cook/drink',component:CookDrinkVue}
        ]
    },
    {
        path:'/',
        component:LoginVue,
        redirect:'/login'
    }
    
]

//创建路由器
const router = createRouter({
    history:createWebHistory(),
    routes:routes
})

//导出路由
export default router